//
// Created by Jisam on 2024/8/19 17:27.
// Solution of  P4343 [SHOI2015] 自动刷题机 题解
// 95 -> 100 注意左的大小 18点07分
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>
using namespace std;

#define endl "\n"
#define PSI pair<string,int>
#define PII pair<int,int>
#define PDI pair<double,int>
#define PDD pair<double,double>
#define VVI vector<vector<int>>
#define VI vector<int>
#define VS vector<string>

#define PQLI priority_queue<int, vector<int>, less<int>>
#define PQGI priority_queue<int, vector<int>, greater<int>>
#define code_by_jisam ios::sync_with_stdio(false),cin.tie(nullptr)
using namespace std;
using u32 = unsigned;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128;
int dx[] = {-1, 1, 0, 0, 1, 1, -1, -1,};
int dy[] = {0, 0, -1, 1, 1, -1, -1, 1,};

i64 check(i64 x, VI &a) {
    i64 ans = 0, sum = 0;
    for (auto & n : a) {
        sum += n;
        if (sum < 0) sum = 0;
        if (sum >= x) sum = 0, ans++;
    }
    return ans;
}

void solution() {
    int l, k;
    cin >> l >> k;
    VI a(l);
    for (auto &x: a)  cin >> x;

    // binary search
    i64 ans1 = -1, ans2 = -1;

    i64 left = 1;
    i64 right = 1e18; // 定义target在左闭右开的区间里，即：[left, right)
    while (left < right) { // 因为left == right的时候，在[left, right)是无效的空间，所以使用 <
        i64 middle = left + ((right - left) >> 1);
        if (check(middle, a) <  k) {
            right = middle; // target 在左区间，在[left, middle)中
        } else if (check(middle, a) > k) {
            left = middle + 1; // target 在右区间，在[middle + 1, right)中
        } else { // nums[middle] == target
            right = middle;
            ans1 = middle;
        }
    }

    left = 1;
    right = 1e18; // 定义target在左闭右开的区间里，即：[left, right)
    while (left < right) { // 因为left == right的时候，在[left, right)是无效的空间，所以使用 <
        i64 middle = left + ((right - left) >> 1);
        if (check(middle, a) < k) {
            right = middle; // target 在左区间，在[left, middle)中
        } else if (check(middle, a) > k) {
            left = middle + 1; // target 在右区间，在[middle + 1, right)中
        } else { // nums[middle] == target
            left = middle  + 1;
            ans2 = middle;
        }
    }
    if (ans1 == -1) cout << "-1";
    else cout << ans1 << " " << ans2 << endl;
}

int main() {
    code_by_jisam;
    int T = 1;
//    cin >> T;
    while (T--) {
        solution();
    }
    return 0;
}